<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        #container {
            position: relative;
            width: 200px;
            height: 200px;
            border: 1px solid #ccc;
            overflow: hidden;
        }

        @keyframes slideDown {
            from {
                transform: translateY(-100%);
            }

            to {
                transform: translateY(0);
            }
        }

        .new-element {
            width: 100%;
            height: 50px;
            background-color: lightblue;
            animation: slideDown 0.5s ease-out;
        }
    </style>
</head>

<body>
    <div id="container"></div>
    <button onclick="mycreateElement()">创建元素</button>

    <script>
        function mycreateElement() {
            const container = document.getElementById('container');
            const newElement = document.createElement('div');
            newElement.classList.add('new-element');
            container.appendChild(newElement);
        }

    </script>

</body>

</html>